home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gpsync.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.6 KB  |  76 lines

  1. /* Copyright (C) 1998 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gpsync.h,v 1.2 2000/09/19 19:00:25 lpd Exp $ */
  20. /* Interface to platform-dependent synchronization primitives */
  21.  
  22. #if !defined(gpsync_INCLUDED)
  23. #  define gpsync_INCLUDED
  24.  
  25. /* Initial version 4/1/98 by John Desrosiers (soho@crl.com). */
  26. /* 8/9/98 L. Peter Deutsch (ghost@aladdin.com) Changed ...sizeof to
  27.    procedures, added some comments. */
  28.  
  29. /* -------- Synchronization primitives ------- */
  30.  
  31. /*
  32.  * Semaphores support wait/signal semantics: a wait operation will allow
  33.  * control to proceed iff the number of signals since semaphore creation
  34.  * is greater than the number of waits.
  35.  */
  36. typedef struct {
  37.     void *dummy_;
  38. } gp_semaphore;
  39.  
  40. uint gp_semaphore_sizeof(P0());
  41. /*
  42.  * Hack: gp_semaphore_open(0) succeeds iff it's OK for the memory manager
  43.  * to move a gp_semaphore in memory.
  44.  */
  45. int gp_semaphore_open(P1(gp_semaphore * sema));
  46. int gp_semaphore_close(P1(gp_semaphore * sema));
  47. int gp_semaphore_wait(P1(gp_semaphore * sema));
  48. int gp_semaphore_signal(P1(gp_semaphore * sema));
  49.  
  50. /*
  51.  * Monitors support enter/leave semantics: at most one thread can have
  52.  * entered and not yet left a given monitor.
  53.  */
  54. typedef struct {
  55.     void *dummy_;
  56. } gp_monitor;
  57.  
  58. uint gp_monitor_sizeof(P0());
  59. /*
  60.  * Hack: gp_monitor_open(0) succeeds iff it's OK for the memory manager
  61.  * to move a gp_monitor in memory.
  62.  */
  63. int gp_monitor_open(P1(gp_monitor * mon));
  64. int gp_monitor_close(P1(gp_monitor * mon));
  65. int gp_monitor_enter(P1(gp_monitor * mon));
  66. int gp_monitor_leave(P1(gp_monitor * mon));
  67.  
  68. /*
  69.  * A new thread starts by calling a procedure, passing it a void * that
  70.  * allows it to gain access to whatever data it needs.
  71.  */
  72. typedef void (*gp_thread_creation_callback_t) (P1(void *));
  73. int gp_create_thread(P2(gp_thread_creation_callback_t, void *));
  74.  
  75. #endif /* !defined(gpsync_INCLUDED) */
  76.